package Java攻略._1_基础知识._3_构造函数引用;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class _15_将字符串转换为Person实例 {

    List<String> names = Arrays.asList("Grace","Barbara","Ada","Karen");

    List<_14_Person> people = names.stream()
            .map(name -> new _14_Person(name)) // 使用lambda表达式来调用构造函数
            .collect(Collectors.toList());

    List<_14_Person> personList = names.stream()
            .map(_14_Person::new)   // 使用构造函数引用来实例化Person
            .collect(Collectors.toList());
}
